// pages/market/market.ts
Page({
  data: {
    numList: [1,2,3]
  },
  onPullDownRefresh(){
    this.setData({
      numList: [1,2,3]
    })
    // 可能会出现下拉刷新的窗口不退出，要手动退出
    if(this.data.numList.length === 3) wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    wx.showLoading({title:'数据加载中...'})

    setTimeout(() => {
      const lastEle = this.data.numList[this.data.numList.length-1]
      console.log('默认数据数组最后一个元素是：' + lastEle)
      let newArr = []
      for(let i=0;i<3;i++){
        const newEle = lastEle + i + 1
        console.log('最新的元素：' + newEle)
        newArr.push(newEle)
      }
      console.log('新增的数组：', newArr)
      this.setData({
        numList:[...this.data.numList,...newArr]
      })
      console.log(this.data.numList)

      wx.hideLoading()
    }, 1500);
  },
})